package com.ants.boot.wx.controller;

import com.ants.boot.core.Response;
import com.ants.boot.wx.dto.wxarticle.DetailArticleDto;
import com.ants.boot.wx.dto.wxarticle.WxPageInfoDto;
import com.ants.boot.wx.service.WxArticleService;
import com.ants.boot.wx.vo.wxarticle.DetailArticleVo;
import com.ants.boot.wx.vo.wxarticle.WxArticleVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 蚂蚁会花呗
 * @date 2022/6/7 11:17
 */
@RestController
@RequestMapping("wx/article")
@Api(tags = "朋友圈列表")
public class WxArticleController {

    @Autowired
    private WxArticleService wxArticleService;


    @PostMapping("wx_page_info")
    @ApiOperation(value = "微信分页",notes = "微信下拉分页")
    @ApiResponses({
            @ApiResponse(code = 200,message = "请求成功！",response = WxArticleVo.class)
    })
    public Response wxPageInfo(@RequestBody @Validated WxPageInfoDto dto){
        return Response.okData(wxArticleService.wxPageInfo(dto));
    }

    @PostMapping("get_detail_article")
    @ApiOperation(value = "朋友圈详情",notes = "点击评论、获取详情信息")
    @ApiResponses({
            @ApiResponse(code = 200,message = "请求成功！",response = DetailArticleVo.class)
    })
    public Response getDetailArticle(@RequestBody @Validated DetailArticleDto dto){
        return Response.okData(wxArticleService.getDetailArticle(dto.getId()));
    }


}
